import VueRouter from "vue-router";
import Vue from "vue";


Vue.use(VueRouter)

import HomePage from '@/views/Home.vue'
import MyCollection from '@/views/Collection.vue'
import MyLike from '@/views/Like.vue'
import NotFind from "@/views/NotFind.vue";
import ProductDetail from "@/views/ProductDetail.vue";
import Article from "@/views/Article.vue";

const router = new VueRouter({
    routes: [
        {
            path: '/',
            component: HomePage,
            redirect: '/article',
            // 配置嵌套子路由，分为两步，第一步配置路由规则，第二步准备二级路由出口,即在home页面中配置 router-view
            children: [
                { path: '/article', component: Article },
                { path: '/collection', component: MyCollection },
                {
                    path: '/like', component: MyLike
                },
            ]
        },
        {
            path: '/detail/:productId', component: ProductDetail,
            name:'productDetail'
        },

        { path: '*', component: NotFind }
    ],
    mode: 'history'
})

export default router